package com.sc.adminspringboot.service.impl;

import com.sc.adminspringboot.dao.DashBoardDao;
import com.sc.adminspringboot.dto.Dashboard;
import com.sc.adminspringboot.service.IDashBoardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class DashBoardServiceImpl implements IDashBoardService {
    @Autowired
    private DashBoardDao dashBoardDao;

    @Override
    public Dashboard getDashboardData() {
        Dashboard dashboard = new Dashboard();
        dashboard.setPendingPosts(dashBoardDao.getPendingPosts());
        dashboard.setNewComments(dashBoardDao.getNewComments());
        dashboard.setNewUsers(dashBoardDao.getNewUsers());
        dashboard.setNewPosts(dashBoardDao.getNewPosts());
        dashboard.setTotalPosts(dashBoardDao.getTotalPosts());
        dashboard.setTotalComments(dashBoardDao.getTotalComments());
        dashboard.setTotalUsers(dashBoardDao.getTotalUsers());
        dashboard.setTotalGames(dashBoardDao.getTotalGames());
        dashboard.setTotalTagsTopic(dashBoardDao.getTotalTags1());
        dashboard.setTotalTagsPreference(dashBoardDao.getTotalTags2());
        dashboard.setNewPostChange(dashBoardDao.getPostChange());
        dashboard.setNewUserChange(dashBoardDao.getUserChange());
        dashboard.setNewCommentChange(dashBoardDao.getCommentChange());
        return dashboard;
    }
}
